Optimal. Leaf size=94 \[ -3 a b x+\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.259, Rules used = {2990, 2671,
294, 327, 209, 4442, 459} \begin {gather*} \frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-3 a b x-\frac {b^2 \cos ^3(c+d x)}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 294
Rule 327
Rule 459
Rule 2671
Rule 2990
Rule 4442
Rubi steps
\begin {align*} \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx &=(2 a b) \int \sin ^2(c+d x) \tan ^2(c+d x) \, dx+\int \sin (c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \tan ^2(c+d x) \, dx\\ &=-\frac {\text {Subst}\left (\int \frac {\left (1-x^2\right ) \left (a^2+b^2-b^2 x^2\right )}{x^2} \, dx,x,\cos (c+d x)\right )}{d}+\frac {(2 a b) \text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-\frac {\text {Subst}\left (\int \left (-a^2 \left (1+\frac {2 b^2}{a^2}\right )+\frac {a^2+b^2}{x^2}+b^2 x^2\right ) \, dx,x,\cos (c+d x)\right )}{d}+\frac {(3 a b) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-\frac {(3 a b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=-3 a b x+\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.32, size = 104, normalized size = 1.11 \begin {gather*} \frac {\sec (c+d x) \left (36 a^2+45 b^2-24 \left (a^2+b^2+3 a b (c+d x)\right ) \cos (c+d x)+4 \left (3 a^2+5 b^2\right ) \cos (2 (c+d x))-b^2 \cos (4 (c+d x))+54 a b \sin (c+d x)+6 a b \sin (3 (c+d x))\right )}{24 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 147, normalized size = 1.56
method | result | size |
derivativedivides | \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{2} \left (\frac {\sin ^{6}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin ^{4}\left (d x +c \right )+\frac {4 \left (\sin ^{2}\left (d x +c \right )\right )}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) | \(147\) |
default | \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{2} \left (\frac {\sin ^{6}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin ^{4}\left (d x +c \right )+\frac {4 \left (\sin ^{2}\left (d x +c \right )\right )}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) | \(147\) |
risch | \(-3 a b x -\frac {i a b \,{\mathrm e}^{2 i \left (d x +c \right )}}{4 d}+\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {7 \,{\mathrm e}^{i \left (d x +c \right )} b^{2}}{8 d}+\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {7 \,{\mathrm e}^{-i \left (d x +c \right )} b^{2}}{8 d}+\frac {i a b \,{\mathrm e}^{-2 i \left (d x +c \right )}}{4 d}+\frac {4 i a b +2 a^{2} {\mathrm e}^{i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {\cos \left (3 d x +3 c \right ) b^{2}}{12 d}\) | \(176\) |
norman | \(\frac {-\frac {12 a^{2}+16 b^{2}}{3 d}+3 a b x -\frac {4 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 \left (12 a^{2}+16 b^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {6 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {10 a b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {10 a b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {6 a b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+6 a b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-6 a b x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a b x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}\) | \(218\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 97, normalized size = 1.03 \begin {gather*} -\frac {3 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} a b + {\left (\cos \left (d x + c\right )^{3} - \frac {3}{\cos \left (d x + c\right )} - 6 \, \cos \left (d x + c\right )\right )} b^{2} - 3 \, a^{2} {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )}}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 91, normalized size = 0.97 \begin {gather*} -\frac {b^{2} \cos \left (d x + c\right )^{4} + 9 \, a b d x \cos \left (d x + c\right ) - 3 \, {\left (a^{2} + 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, a^{2} - 3 \, b^{2} - 3 \, {\left (a b \cos \left (d x + c\right )^{2} + 2 \, a b\right )} \sin \left (d x + c\right )}{3 \, d \cos \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sin {\left (c + d x \right )}\right )^{2} \sin ^{3}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 172, normalized size = 1.83 \begin {gather*} -\frac {9 \, {\left (d x + c\right )} a b + \frac {6 \, {\left (2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} + \frac {2 \, {\left (3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 3 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2} - 5 \, b^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3}}}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 18.49, size = 149, normalized size = 1.59 \begin {gather*} -3\,a\,b\,x-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (8\,a^2+\frac {32\,b^2}{3}\right )+4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+4\,a^2+\frac {16\,b^2}{3}+10\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+10\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+6\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+6\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________